﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TrainingsApp.Model {
    public class EnumsHelper {

        static readonly Dictionary<string, SchoolType> SchoolTypeDict;


        static EnumsHelper() {
            SchoolTypeDict = new Dictionary<string, SchoolType>(20);

            SchoolTypeDict.Add("职工高校", SchoolType.AdultCollege);
            SchoolTypeDict.Add("完全中学", SchoolType.AllSecondary);
            SchoolTypeDict.Add("工读学校", SchoolType.Approved);
            SchoolTypeDict.Add("学院", SchoolType.College);
            SchoolTypeDict.Add("教育学院", SchoolType.CollegeOfEducation);
            SchoolTypeDict.Add("聋人学校", SchoolType.DeafPeople);
            SchoolTypeDict.Add("培养研究生的科研机构", SchoolType.GraduateFaculty);
            SchoolTypeDict.Add("高等专科学校", SchoolType.HighProfessionalSchool);
            SchoolTypeDict.Add("职业高中学校", SchoolType.HighSchool);
            SchoolTypeDict.Add("高级中学", SchoolType.HighSecondary);
            SchoolTypeDict.Add("高等职业学校", SchoolType.HighTechnicalSchool);
            SchoolTypeDict.Add("独立学院", SchoolType.IndependentCollege);
            SchoolTypeDict.Add("九年一贯制学校", SchoolType.NineYearSecondary);
            SchoolTypeDict.Add("幼儿园", SchoolType.Nursery);
            SchoolTypeDict.Add("其他机构", SchoolType.Other);
            SchoolTypeDict.Add("其他中学机构", SchoolType.OtherHighSchool);
            SchoolTypeDict.Add("其他特教学校", SchoolType.OtherSecondary);
            SchoolTypeDict.Add("小学", SchoolType.Primary);
            SchoolTypeDict.Add("成人中等专业学校", SchoolType.ProfessionalSchool);
            SchoolTypeDict.Add("广播电视大学", SchoolType.RadioATelevision);
            SchoolTypeDict.Add("弱智学校", SchoolType.Retard);
            SchoolTypeDict.Add("中学", SchoolType.Secondary);
            SchoolTypeDict.Add("中等技术学院", SchoolType.TechnicalSchool);
            SchoolTypeDict.Add("十二年一贯制学校", SchoolType.TwelveYearSecondary);
            SchoolTypeDict.Add("大学", SchoolType.University);
        }

        public static SchoolType ConvertSchoolType(string val) {
            val = val.Trim();
            SchoolType outVal = SchoolType.Unknow;
            if (SchoolTypeDict.TryGetValue(val, out outVal)) {
                return outVal;
            }
            return SchoolType.Unknow;
        }
    }
}
